import React from "react";

function SwapView({ onDrop, children, accept }) {
  const _onDrop = (e) => {
    let endId = "";
    if (e?.target?.dataset?.id) {
      endId = e?.target?.dataset?.id;
    } else {
      endId = e?.target?.parentNode?.dataset?.id;
    }
    onDrop && onDrop(endId);
  };

  const _onDragOver = (e) => {
    e.preventDefault();
  };

  return (
    <div onDragOver={_onDragOver} onDrop={_onDrop}>
      {children}
    </div>
  );
}
export default SwapView;
